-
Notifications
You must be signed in to change notification settings - Fork 8
feat: settings in seed #682
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
logan-r
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good 👍
| openTime: { | ||
| type: Date, | ||
| default: 0 | ||
| default: Date.now() + 2628000000 // One month from now. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe it'd be a good idea to have it default to a day before Date.now()?
Only time I can think of were we should be using defaults is for local environment and applications open is probably most useful state for that?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I set it 1mo from now for production reasons. I wouldn't want the API to be able to accept applications right away.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The other time we use defaults is when you create a new DB for production (which may or may not happen, but it could).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, that's fair
tests/util/settings.test.util.js
Outdated
| settingConfirmClosed: Constants.Settings.CONFIRM_CLOSED, | ||
| settingRemoteHackathon: Constants.Settings.REMOTE_HACKATHON |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we remove this export and just have whatever code referencing this to just import Constants instead to be consistent?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree, since Constants.Settings is not used directly anywhere in this util script.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jamesxu123 Sorry for my previous comment. I re-read settings.test.util.js and saw that Constants.Settings actually is used in lines 8, 14, 25.
I also checked out other *.test.js and *.test.util.js scripts, and it seems like we have previously been exporting objects from the *.test.util.js scripts. However, that was due to the need to create objects using the constants (example).
Since here we use the constants directly, should I just import them into settings.test.js, or would it be better to follow the same structure and keep the export here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@chenxuan-zhou Let's move it all to Constants. It's more consistent with the rest of the constant vars.
jamesxu123
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good!
* refactor: move const settings objects into constants file * feat: add settings to seed script * fix: update settings schema defaults so that they are more sensible, and use that in seed * fix: export and use settings constants * fix: import setting constants directly in test Co-authored-by: chenxuan-zhou <46543122+chenxuan-zhou@users.noreply.github.com> Co-authored-by: James Xu <xujames007@gmail.com>
Tickets:
List of changes:
Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context. List any dependencies that are required for this change.
Type of change
How has this been tested?
npm run seedmanuallyTest Configuration:
Firmware version:
Hardware:
Toolchain:
SDK:
Questions for code reviewers?
Checklist: